<?php

/**
 * IndexController - The default controller class
 * 
 * @author
 * @version 
 */

require_once 'Zend/Controller/Action.php';

class Adminb_BankController extends Zend_Controller_Action 
{
	

	
	public function init(){
		
		$member=new CMember();
		
		if(!$member->isUser($this->_request->getModuleName(),$this->_request->getControllerName())){
			
			if($_COOKIE[COOKIE_PRE.'uid']!=''){
				
				$this->_redirect(MY_URL.'/seller');
				
			}else{
			
				$this->_redirect(MY_URL.'/seller-auth-login');
				
			}
			
		}
		
	}
	
	public function preDispatch()
	{

		$this->getHelper ('layout')->setLayout('framelayout');
		
		$this->view->addHelperPath(MY_ROOT.'/vhelpers');
		
		Zend_Controller_Action_HelperBroker::addPath(MY_ROOT.'/chelpers');

	}

	
    public function dodelAction(){
    	
    	$this->_helper->viewRenderer->setNoRender();
		
		$this->getHelper ('layout')->disableLayout ();
		
		$bankid=$this->_request->getParam('bankid');
		
		$bank=new CBank();
		
		$bank->delBanks(array($bankid));
		
		echo 'success';
    	
    }
    
    public function doeditAction(){
    	
    	$this->_helper->viewRenderer->setNoRender();
		
		$this->getHelper ('layout')->disableLayout ();
		
		$bankid=$this->_request->getParam('bankid');
		
		$thisArray=$this->_request->getParams();
    	
		$filters = array(
    		'*'   => 'StringTrim'
		);

		$validators = array(
		);
		
		$input = new Zend_Filter_Input($filters, $validators, $thisArray);
		
		$bank=new CBank();
		
		$bank->editBank($bankid,array('bank_name'=>$input->bank_name,'bank_account'=>$input->bank_account));
		
		echo 'success';
    	
    }

	
	public function postAction(){
	
		//$this->_helper->viewRenderer->setNoRender();
		
		//$this->getHelper ('layout')->disableLayout ();
	
	}
    

    
}
